<template>
  <div>
    <div class="bgc_gray" v-if="showFlag">
      {{ $route.query.id }}
      <van-cell
      
        v-for="(item, index) in cateList"
        :key="index"
        :title="item.title"
        :value="'id  ' + item.id + '***********' + 'dataid' + item.dataid"
        is-link
        @click="
          $router.push({
            path:  '/addhomework',
            query: {
              id: item.id,
            },
          })
        "
      >
      </van-cell>

      <!-- 测试  本页面不能跳 -->
     
      
      <!--     <van-cell
        v-if="Boolean(item.dataid)"
        v-for="(item, index) in cateList"
        :key="index"
        :title="item.title"
        :value="'id  ' + item.id + '***********' + 'dataid' + item.dataid"
        is-link
        @click="
          $router.push({
            path: '/homeworkCate',
            query: {
              id: item.id,
            },
          })
        "
      > -->
      <!-- <template slot="extra">555 </template> -->
      <!-- </van-cell> -->
    </div>
  </div>
</template>

<script>
/* $router.push({
  path: Boolean(item.dataid) ? '/homeworkCate' : '/addhomework',
  query: {
    id: item.id,
  },
}) */
import { tikuCateList } from '@/api'

export default {
  data() {
    return {
      cateList: null,
      showFlag: true,
    }
  },
  created() {
    this.getList1()
  },
  mounted() {},

  methods: {
    /*    toWantRouter(id, flag) {
      this.$store.commit('setRouter', id)
      console.log(this.$store.state.id)
      this.showFlag = false
      if (+flag > 0) {
        this.showFlag = true
        console.log(this.$store.state.id)
        this.$router.go(0)
        this.$nextTick(() => {
          this.$router.push('/homeworkCate', {
            query: {
              id: this.$store.state.id,
            },
          })
        })
      } else {
        console.log(this.$store.state.id)

        this.$router.push('/addhomework', {
          query: {
            id: this.$store.state.id,
          },
        })
      }
    }, */
    async getList1() {
      try {
        const { data: res } = await tikuCateList(this.$route.query.id)
        console.log(res.data, 'id222')
        this.cateList = res.data
      } catch (err) {
        console.log(err)
      }
    },
  },
}
</script>
<style lang="scss" scoped>
.bgc_gray {
  width: 375px;
  height: 700px;
  background-color: #efeff4;
  padding: 20px;
}
</style>
